import fetch from '@/utils/fetch'

// 用户
export function getList(crr) {
  return fetch({
    url: '/user/list',
    method: 'get'
  })
}
export function edit(id) {
  return fetch({
    url: '/user/getInfo',
    method: 'post',
    params: { id }
  })
}
export function updateApi(p) {
  return fetch({
    url: '/user/update',
    method: 'post',
    params: p
  })
}
export function add(p) {
  return fetch({
    url: '/user/update',
    method: 'get',
    params: p
  })
}
export function del(id) {
  return fetch({
    url: '/user/del',
    method: 'post',
    params: { id }
  })
}
export function query(p) {
  return fetch({
    url: '/user/list',
    method: 'post',
    params: p
  })
}
export function getPageList(name, status, curr) {
  return fetch({
    url: '/user/list',
    method: 'post',
    params: { name, status, curr }
  })
}
// 警报
export function getAlertData(curr) {
  return fetch({
    url: '/push/list',
    method: 'post',
    params: { curr }
  })
}
// 分站终端列表
export function getstationData(p) {
  return fetch({
    url: '/station/list',
    method: 'post',
    params: p
  })
}
export function getstationInfo(id) {
  return fetch({
    url: 'station/getInfo',
    method: 'post',
    params: { id }
  })
}
export function updateStationInfo(p) {
  return fetch({
    url: 'station/update',
    method: 'post',
    params: p
  })
}

export function addStationInfo(p) {
  return fetch({
    url: 'station/update',
    method: 'get',
    params: p
  })
}

export function delStation(id) {
  return fetch({
    url: 'station/del',
    method: 'post',
    params: { id }
  })
}
// 设备列表
export function getEquipData(station_id, name, status, curr) {
  return fetch({
    url: 'equipment/list',
    method: 'post',
    params: { station_id, name, status, curr }
  })
}
export function getEquipDetail(id) {
  return fetch({
    url: 'equipment/getInfo',
    method: 'post',
    params: { id }
  })
}
export function updateInfo(p) {
  return fetch({
    url: 'equipment/update',
    method: 'post',
    params: p
  })
}
export function delEquip(id) {
  return fetch({
    url: 'equipment/del',
    method: 'post',
    params: { id }
  })
}
// 温度列表
export function getTemperData(id, type, start_time, end_time) {
  return fetch({
    url: 'monitor/list',
    method: 'post',
    params: { id, type, start_time, end_time }
  })
}
